//
//  NavigationViewController.m
//  SpeechRecognition
//
//  Created by 张云江 on 2019/9/28.
//  Copyright © 2019年 张云江. All rights reserved.
//

#import "NavigationViewController.h"

@interface NavigationViewController ()

@end

@implementation NavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationBar.hidden = YES;
    
    self.interactivePopGestureRecognizer.delegate = nil;
}

+ (void)initialize
{
    [UINavigationBar appearance].translucent = NO;
    [[UINavigationBar appearance] setBarStyle:UIBarStyleDefault];
    [[UINavigationBar appearance] setBarTintColor:kUIColorFromRGB(0xFFFFFF)];
    [[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang SC" size: 18],NSForegroundColorAttributeName: kUIColorFromRGB(0x000000)}];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.childViewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"Back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(back:)];
    }
    [super pushViewController:viewController animated:animated];
}

- (void)back:(id)sender
{
    [self popViewControllerAnimated:YES];
}

@end
